from rest_framework.authentication import SessionAuthentication


class CsrfExemptSessionAuthentication(SessionAuthentication):
    """
    自定义Session认证类，免除CSRF检查
    用于API接口
    """
    def enforce_csrf(self, request):
        return  # 跳过CSRF检查